<?php 
/**
 * File: View - Conteudo - index.phtml
 */

 $this->jQuery()
	 ->addJavascriptFile( $this->layout_base . '/third/js/tree.view.js')
	 ->addJavascriptFile( $this->layout_base . '/third/js/tiny_mce/jquery.tinymce.js')
	 ->addJavascriptFile( $this->layout_base . '/third/js/modules/conteudo.js');
	 
	$this
	->headLink()
	->appendStylesheet( $this->layout_base . '/third/css/categorias.css');
 
?>
			<div class="page-title ui-widget-content ui-corner-all">
				<div>
						<div class="float-left">
							<br />
							<h1>Conte&uacute;do <?php if( $this->categoria['titulo']) echo " -  Categoria: ".$this->categoria['titulo']; ?></h1>
						</div>
						<?php 
							switch( $this->categoria['tipo'] ){
								case 'Pagina':
									
								break;
								default:
									if( $this->categoria['id'] ){
										echo '
											<div class="button float-right">
												<a href="/third/conteudo/add/categoria/'.$this->categoria['id'].'"  class="btn ui-state-default"><span class="ui-icon ui-icon-circle-plus"></span>Adicionar novo</a>
											</div>
										';
									} else {
										echo '
											<div class="button float-right">
												<a href="/third/conteudo/add"  class="btn ui-state-default"><span class="ui-icon ui-icon-circle-plus"></span>Adicionar novo</a>
											</div>
										';
									}
								break;
							}
						
						?>
						<div class="clearfix"></div>
				</div>

				<div id="main-itens-content" class="hastable other" >

				<?php echo($this->flashMessages()); ?>


			<?php 
			//SIDEBAR - CATEGORIAS
				$this->placeholder('sidebar')->captureStart('SET', 'data');
			?>
				<div class="portlet ui-widget ui-widget-content ui-helper-clearfix ui-corner-all">
					<div class="portlet-header">Categorias</div>
					<div class="portlet-content">
						<?php 
							if( $this->categorias ){
								echo Third_Funcs::arrayToULEdit( $this->categorias, '/third/conteudo/index/id/', true );
							}
						?>
					</div>
				</div>
				<script type="text/javascript">	
				$(document).ready(function() { 
					var treeIds = ['categorias_tree_content'] ;
					var tree = new TreeView( treeIds );
				});
				</script>
		<?php 
			$this->placeholder('sidebar')->captureEnd();
		?>		

		<?php 
			switch( $this->categoria['tipo'] ){
				case 'Pagina':
					echo $this->action('edit', 'conteudo', 'third', array('conteudo'=>$this->conteudo ) );	
				break;
				default:
					include('tipos/listagem.phtml');
				break;
			}	
		?>
						<div class="clearfix"></div>
				</div>
			</div>
